<?php

namespace backend\assets;

use yii\web\AssetBundle;

/**
 * Main backend application asset bundle.
 */
class AppAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web';
    public $css = [
        //'css/site.css',
        //'static/lib/css/bootstrap.min.css',
        'static/lib/hplus/css/font-awesome.min.css',
        'static/lib/hplus/css/animate.min.css',
        'static/lib/hplus/css/h.min.css',
        'static/css/style.css',
    ];

  public $jsOptions = [
    //'position' => \yii\web\View::POS_HEAD
  ];

    public $js = [

    ];
    public $depends = [
        'yii\web\YiiAsset',
        'yii\web\JqueryAsset',
        'yii\bootstrap\BootstrapAsset',
        'backend\assets\CommonAsset',
    ];

  public static function addDepends()
  {
    

  }

  /**
   * @param $view \yii\web\View
   * @param $jsfile string
   * @param $k string
   */
  public static function addScript($view, $jsfile,$k = 'jq') {
    $arr = [
      'jq'=>'yii\web\JqueryAsset',
      'bs'=>'yii\bootstrap\BootstrapPluginAsset',
      'toastr'=>'backend\assets\ToastrAsset',
      'com'=>'backend\assets\CommonAsset',
    ];
    if(isset($arr[$k])){
      $depends = $arr[$k];
    }else{
      $depends = $arr['com'];
    }
    $view->registerJsFile($jsfile, [AppAsset::className(), 'depends' => $depends]);
  }

  /**
   * @param $view \yii\web\View
   * @param $cssfile string
   */
  public static function addCss($view, $cssfile) {
    $view->registerCssFile($cssfile,[AppAsset::className(), 'depends' => 'yii\bootstrap\BootstrapAsset']);
  }




}
